QuickOPC User's Guide and Reference
GetItemPropertyRecord(IEasyDAClient,String,String,String,IEnumerable<DAPropertyId>,Boolean) Method
Example 



OpcLabs.EasyOpcClassic Assembly > OpcLabs.EasyOpc.DataAccess.Extensions Namespace > IEasyDAClientExtension2 Class > GetItemPropertyRecord Method : GetItemPropertyRecord(IEasyDAClient,String,String,String,IEnumerable<DAPropertyId>,Boolean) Method
The client object that will perform the operation.
Name of the machine. Determines the computer on which the OPC server is located. May be an empty string, in which case the OPC server is assumed to exist on the local computer or at the computer specified for it by DCOM configuration.
Contains ProgID of the OPC server to read from.
Contains OPC item identifier.
Specifies which OPC properties should be obtained and returned.
If false, any failures cause the method to throw an exception. If true, failures are ignored, and the affected OPC properties will contain default values.
Obtains a DAItemPropertyRecord structure filled with OPC property values for a given OPC item. Obtains a structure filled with OPC property values for a given OPC item. You can specify the property Ids.
Syntax
'Declaration
 
<ExtensionAttribute()>
<NotNullAttribute()>
Public Overloads Shared Function GetItemPropertyRecord( _
   ByVal client As IEasyDAClient, _
   ByVal machineName As String, _
   ByVal serverClass As String, _
   ByVal itemId As String, _
   ByVal propertyIds As IEnumerable(Of DAPropertyId), _
   ByVal allowFailures As Boolean _
) As DAItemPropertyRecord
'Usage
 
Dim client As IEasyDAClient
Dim machineName As String
Dim serverClass As String
Dim itemId As String
Dim propertyIds As IEnumerable(Of DAPropertyId)
Dim allowFailures As Boolean
Dim value As DAItemPropertyRecord
 
value = IEasyDAClientExtension2.GetItemPropertyRecord(client, machineName, serverClass, itemId, propertyIds, allowFailures)

Parameters

client
The client object that will perform the operation.
machineName
Name of the machine. Determines the computer on which the OPC server is located. May be an empty string, in which case the OPC server is assumed to exist on the local computer or at the computer specified for it by DCOM configuration.
serverClass
Contains ProgID of the OPC server to read from.
itemId
Contains OPC item identifier.
propertyIds
Specifies which OPC properties should be obtained and returned.
allowFailures
If false, any failures cause the method to throw an exception. If true, failures are ignored, and the affected OPC properties will contain default values.

Return Value

Returns a structure containing the OPC property values requested.
Exceptions
ExceptionDescription
The OPC "Classic" (or OPC XML-DA) operation has failed.
A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.
Remarks
This method allows you to obtain a structure filled in with property values for a given OPC item. It can retrieve all well-known properties at once, or you can pass in a set of property Ids that you are interested in. You can then simply use the properties in the resulting DAItemPropertyRecord structure, without further looking up the values in any way.
Example
// This example shows how to obtain a structure containing property values for an OPC item, and display some property values.

using System;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.DataAccess.Extensions;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.DataAccess._EasyDAClientExtension
{
    class GetItemPropertyRecord
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            // Get a structure containing values of all well-known properties
            DAItemPropertyRecord itemPropertyRecord;
            try
            {
                itemPropertyRecord = client.GetItemPropertyRecord("", "OPCLabs.KitServer.2", "Simulation.Random");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            // Display some of the obtained property values
            Console.WriteLine("itemPropertyRecord.AccessRights: {0}", itemPropertyRecord.AccessRights);
            Console.WriteLine("itemPropertyRecord.DataType: {0}", itemPropertyRecord.DataType);
            Console.WriteLine("itemPropertyRecord.Timestamp: {0}", itemPropertyRecord.Timestamp);
        }
    }
}
' This example shows how to obtain a structure containing property values for an OPC item, and display some property values.

Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.DataAccess.Extensions
Imports OpcLabs.EasyOpc.OperationModel

Namespace DocExamples.DataAccess._EasyDAClientExtension
    Friend Class GetItemPropertyRecord
        Public Shared Sub Main1()
            Dim client = New EasyDAClient()

            ' Get a structure containing values of all well-known properties
            Dim itemPropertyRecord As DAItemPropertyRecord
            Try
                itemPropertyRecord = client.GetItemPropertyRecord("", "OPCLabs.KitServer.2", "Simulation.Random")
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            ' Display some of the obtained property values
            Console.WriteLine("itemPropertyRecord.AccessRights: {0}", itemPropertyRecord.AccessRights)
            Console.WriteLine("itemPropertyRecord.DataType: {0}", itemPropertyRecord.DataType)
            Console.WriteLine("itemPropertyRecord.Timestamp: {0}", itemPropertyRecord.Timestamp)
        End Sub
    End Class
End Namespace
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2012, Windows Server 2016; .NET Core, .NET 5, .NET 6: Linux, macOS, Microsoft Windows

See Also

Reference

IEasyDAClientExtension2 Class
IEasyDAClientExtension2 Members
Overload List